AddStategraphState("wilson",
    State {
        name = "assn_skill1",
        tags = { "doing", "busy", "canrotate" },

        onenter = function(inst)
            inst.components.locomotor:Stop()
            local x, y, z = inst.Transform:GetWorldPosition()
            SpawnPrefab("fused_shadeling_spawn_fx").Transform:SetPosition(x, y, z)
            inst.AnimState:PlayAnimation("jumpportal")
            inst.SoundEmitter:PlaySound("rifts4/beefalo_revive/player_debuff")
        end,

        events =
        {
            EventHandler("animover", function(inst)
                if inst.AnimState:AnimDone() then
                    inst.components.sanity:DoDelta(-20)
                    inst.components.hunger:DoDelta(-20)
                    inst.components.stamina:DoDelta(-50)
                    inst.Transform:SetScale(2, 2, 2)
                    inst.components.talker:Say("范围打击已启动")

                    local x, y, z = inst.Transform:GetWorldPosition()
                    local fx = SpawnPrefab("fused_shadeling_spawn_fx")
                    fx.Transform:SetPosition(x, y, z)
                    fx.Transform:SetScale(2, 2, 2)
                    inst.sg:GoToState("idle")
                end
            end),
        },
    }
)

AddStategraphState("wilson",
    State {
        name = "assn_skill2",
        tags = { "doing", "busy", "canrotate" },

        onenter = function(inst)
            inst.components.locomotor:Stop()
            inst.AnimState:PlayAnimation("atk_leap")
            inst.SoundEmitter:PlaySound("dontstarve/common/fireAddFuel")
        end,

        events =
        {
            EventHandler("animover", function(inst)
                if inst.AnimState:AnimDone() then
                    inst.components.stamina:DoDelta(-50)
                    local x, y, z = inst.Transform:GetWorldPosition()
                    local fx = SpawnPrefab("halloween_firepuff_cold_1")
                    fx.Transform:SetPosition(x, y, z)
                    inst.components.talker:Say("真实之怒已启动")
                    inst.sg:GoToState("idle")
                end
            end),
        },
    }
)

AddStategraphState("wilson",
    State {
        name = "assn_skill3",
        tags = { "doing", "busy", "canrotate" },

        onenter = function(inst)
            inst.components.locomotor:Stop()
            local x, y, z = inst.Transform:GetWorldPosition()
            SpawnPrefab("fused_shadeling_spawn_fx").Transform:SetPosition(x, y, z)
            inst.AnimState:PlayAnimation("jumpportal")
        end,

        events =
        {
            EventHandler("animover", function(inst)
                if inst.AnimState:AnimDone() then
                    inst.components.stamina:DoDelta(-120)
                    inst.Transform:SetScale(3, 3, 3)
                    inst.components.talker:Say("超巨大化已启动")

                    local x, y, z = inst.Transform:GetWorldPosition()
                    local fx1 = SpawnPrefab("fused_shadeling_spawn_fx")
                    fx1.Transform:SetPosition(x, y, z)
                    fx1.Transform:SetScale(3, 3, 3)
                    local fx2 = SpawnPrefab("lavaarena_portal_player_fx")
                    fx2.Transform:SetPosition(x, y, z)
                    fx2.Transform:SetScale(3, 3, 3)
                    inst.sg:GoToState("idle")
                end
            end),
        },
    }
)
